package com.ateam.dao.impl;

import java.util.List;

import org.mybatis.spring.SqlSessionTemplate;

import com.ateam.dao.SharesDao;
import com.ateam.pojo.Shares;

/** 
* @author WuYuan
* 
*/
public class SharesDaoImpl implements SharesDao {
private SqlSessionTemplate sqlSessionTemplate;
	
	public SqlSessionTemplate getSqlSessionTemplate() {
		return sqlSessionTemplate;
	}

	public void setSqlSessionTemplate(SqlSessionTemplate sqlSessionTemplate) {
		this.sqlSessionTemplate = sqlSessionTemplate;
	}
	
	@Override
	public int addShare(Shares share) throws Exception {
		return sqlSessionTemplate.insert("addShare",share);
	}

	@Override
	public List<Shares> getShares(int companyid) throws Exception {
		return sqlSessionTemplate.selectList("getShares", companyid);
	}

	@Override
	public List<Shares> getSharesByFatherid(int fathershareid) throws Exception {
		return sqlSessionTemplate.selectList("getSharesByFatherid", fathershareid);
	}

	@Override
	public List<Shares> getSharesByProjectid(int projectid) throws Exception {
		return sqlSessionTemplate.selectList("getSharesByProjectid", projectid);
	}

	@Override
	public List<Shares> getSharesByGroupid(int groupid) throws Exception {
		return sqlSessionTemplate.selectList("getSharesByGroupid", groupid);
	}

	@Override
	public List<Shares> getSharesByUserid(int userid) throws Exception {
		return sqlSessionTemplate.selectList("getSharesByUserid", userid);
	}

}
